//
//  DetailsWebCell.m
//  Cat
//
//  Created by lushitong on 2019/1/16.
//  Copyright © 2019年 lushitong. All rights reserved.
//

#import "DetailsWebCell.h"
#import "FLImageView.h"
#import "ProductInfo.h"

@interface DetailsWebCell()

@property (nonatomic, strong) NSMutableArray *viewArray;

@end

@implementation DetailsWebCell

- (void)setCellModelData:(id)cellModelData {
	if ([cellModelData isKindOfClass:[ProductInfo class]]) {
		ProductInfo *model = (ProductInfo *)cellModelData;
		for (FLImageView *view in self.viewArray) {
			[view removeFromSuperview];
		}
		[self.viewArray removeAllObjects];
		
		for (int i = 0; i < model.detail.count; i ++) {
			FLImageView *image = [[FLImageView alloc] initWithFrame:CGRectMake(0, ScreenWidth * i, ScreenWidth, ScreenWidth)];
			image.contentMode = UIViewContentModeScaleAspectFill;
			[image setImageUrl:[NSURL URLWithString:[model.imgs safeObjectAtIndex:i]] size:CGSizeMake(ScreenWidth, ScreenWidth) cornerRadius:0.0];
			[self.contentView addSubview:image];
		}
	}

}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
	self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
	if (self) {
		self.cellSeparatorStyle = QKUITableViewCellSeparatorStyleSingleLineBottomZero;
		self.selectionStyle = UITableViewCellSelectionStyleNone;
	}
	return self;
}

@end
